<template>
  <el-container>
    <el-header>

      <el-menu :default-active="activeIndex2" class="el-menu-demo" mode="horizontal" @select="handleSelect"
        background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
        <h3>UNI-ADMIN</h3>

        <el-menu-item v-for="item, index in this.$store.state.Treelist" :key="index" :index="index"
          @click="TabindexHandle(index, item.desc)">{{ item.name }}</el-menu-item>

        <el-row class="demo-avatar demo-basic">
          <el-col :span="12">
            <div class="demo-basic--circle">
              <el-avatar :size="size" :src="circleUrl"></el-avatar>
            </div>
          </el-col>
        </el-row>

      </el-menu>





    </el-header>
    <el-container>
      <el-aside width="200px">
        <ul class="asideNav">
         
          <li :class="{ active: this.fontindex == index }"
            v-for="item, index in this.$store.state.Treelist[Tabindex].child" @click="jumpHandle(item.desc, index)">
            <i class="el-icon-s-grid"></i>
            {{item.name }}
          </li>
        </ul>

      </el-aside>

      <el-main class="main">

        <router-view></router-view>

      </el-main>
    </el-container>
  </el-container>
</template>

<script>



export default {
  data() {
    return {
      activeIndex: '1',
      activeIndex2: '1',
      Treelist: [],
      Tabindex: 0,
      circleUrl: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
      fontindex: 0,
    };
  },
  mounted() {

  },
  methods: {
    handleSelect(key, keyPath, index) {
      // console.log(key, keyPath, index);
    },
    TabindexHandle(index, desc) {
      this.Tabindex = index
      this.$store.commit('setindex', this.Tabindex)
      this.$router.push(`/${desc.replaceAll("_", "/")}`)
      this.fontindex = 0
    },
    jumpHandle(desc, index) {
      this.$router.push(`/${desc.replaceAll("_", "/")}`)
      this.fontindex = index
    }
  }
}

</script>
<style scoped>
.el-header,
.el-footer {
  background-color: #B3C0D1;
  color: #333;
  text-align: center;
  line-height: 60px;
}
.box{
  padding: 20px;
}
.main{
  padding: 0;
}
.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body>.el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.el-header {
  width: 100%;
  --el-header-padding: 0px;

}

.el-menu {
  box-sizing: border-box;
  display: flex;
  justify-content: flex-end;
  height: 100%;
 
}

.el-menu h3 {
  position: absolute;
  left: 40px;
  top: 0;
  color: rgb(255, 255, 255);
  font-size: 25px;
}

.el-container {
  width: 100%;
  height: 500px;
}

.asideNav {
  width: 100%;
  height: 100%;
  background: rgb(255, 255, 255);
}

.asideNav li {
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;

}

.asideNav li:hover {
  background: rgba(56, 161, 18, 0.2);
}

.active {
  color: rgb(123, 184, 164);
  background: rgba(58, 172, 145, 0.1);
}
</style>
